package lovo01.lesson06;

import lovo01.lesson04.Farmer;

import javax.swing.*;
import java.awt.*;

/**
 * 窗口
 */
public class PukeFrame extends JFrame {

    private DouDiZhu douDiZhu = new DouDiZhu();
    private ImageIcon player1 = new ImageIcon("images/player01.jpg");
    private ImageIcon player2 = new ImageIcon("images/player02.jpg");
    private ImageIcon player3 = new ImageIcon("images/player03.jpg");


    public PukeFrame(DouDiZhu douDiZhu){
        JLabel jLabel01 = new JLabel(player1);
        JLabel jLabel02 = new JLabel(player2);
        JLabel jLabel03 = new JLabel(player3);

        jLabel01.setBounds(20,330,80,80);
        jLabel02.setBounds(550,650,80,80);
        jLabel03.setBounds(1070,330,80,80);

        JLabel jLabelText = new JLabel("地主牌");
        jLabelText.setBounds(400,50,120,30);
        jLabelText.setFont(new Font("正楷",Font.PLAIN,20));

        for (int i = 0;i < 17;i++){
            int num = (douDiZhu.puKes.get(i).getPointValue()) / 10;
            int num2 = 5 - (douDiZhu.puKes.get(i).getPointValue()) % 10;
            System.out.println(num);

            JLabel jLabel = new JLabel(new ImageIcon("images/3_1.jpg"));
            jLabel.setBounds(130,520 - (i * 30),105,150);
            this.add(jLabel);
        }
        for (int i = 17;i < 34;i++){
            int num = (douDiZhu.puKes.get(i).getPointValue()) / 10;
            int num2 = 5 - (douDiZhu.puKes.get(i).getPointValue()) % 10;

            JLabel jLabel = new JLabel(new ImageIcon("images/5_1.jpg"));
            jLabel.setBounds(950,1030 - (i * 30),105,150);
            this.add(jLabel);
        }
        for (int i = 34;i < 51;i++){
            int num = (douDiZhu.puKes.get(i).getPointValue()) / 10;
            int num2 = 5 - (douDiZhu.puKes.get(i).getPointValue()) % 10;

            JLabel jLabel = new JLabel(new ImageIcon("images/6_2.jpg"));
            jLabel.setBounds(780,600,105,150);
            this.add(jLabel);
        }
        for (int i = 51;i < 54;i++){
            int num = (douDiZhu.puKes.get(i).getPointValue()) / 10;
            int num2 = 5 - (douDiZhu.puKes.get(i).getPointValue()) % 10;

            JLabel jLabel = new JLabel(new ImageIcon("images/7_3.jpg"));
            jLabel.setBounds(300,100,105,150);
            this.add(jLabel);
        }

        //添加组件进容器
        this.add(jLabel01);
        this.add(jLabel02);
        this.add(jLabel03);
        this.add(jLabelText);
        //设置窗口关闭策略
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        //设置布局管理器为空
        this.setLayout(null);
        //设置窗口大小
        this.setSize(1200,800);
        //设置窗口默认打开位置居中
        this.setLocationRelativeTo(null);
        //设置窗口为显示状态
        this.setVisible(true);
    }

}
